﻿#include "EightTrigrams.h"
#include <QFile>
#include <QMessageBox>
#include <QTextCodec>

void* GetNewComponent()
{
    return new EightTrigrams();
}

const char* GetComponentName()
{
    return QStringLiteral("八卦").toUtf8().data();
}

const char* GetComponentDescription()
{
    QString strDes = "";
    strDes += QStringLiteral("先天八卦，后天八卦");
    strDes += "\n";
    return strDes.toUtf8().data();
}

EightTrigrams::EightTrigrams()
{
    m_pSvg = new QSvgWidget();
}

void EightTrigrams::Excute(const char* content)
{
    QString str = QString::fromLocal8Bit(content);
    QString svgPath = ":/svg/circle.svg";
    QFile file(svgPath);
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        str = file.readAll();
        QByteArray data = str.toUtf8();
        m_pSvg->load(data);
        m_pSvg->show();
        file.close();
    }
}
